#include<bits/stdc++.h>
using namespace std;

int main()
{
	int n;
	string name, sex;
	int score;
	int cntM, cntW, cntSM, cntSW;
	cntM = cntW = cntSM = cntSW = 0;
	cin>>n;
	for(int i = 1;i <= n;i++)
	{
		cin>>name>>sex>>score;
		if(sex == "M")
		{
			cntM++;
			cntSM += score;
		}
		else
		{
			cntW++;
			cntSW += score;
		}
	}
	cout<<fixed<<setprecision(1);
	if(cntM == 0)
		cout<<1.0*(cntSM+cntSW)/(cntM+cntW)<<" X "<<1.0*cntSW/cntW;
	else if(cntW == 0)
		cout<<1.0*(cntSM+cntSW)/(cntM+cntW)<<" "<<1.0*cntSM/cntM<<" X ";
	else
		cout<<1.0*(cntSM+cntSW)/(cntM+cntW)<<" "<<1.0*cntSM/cntM<<" "<<1.0*cntSW/cntW;
	return 0;
}

